<?php

/**
 * This is the model class for table "{{private_message}}".
 *
 * The followings are the available columns in table '{{private_message}}':
 * @property string $pmid
 * @property string $from_uid
 * @property string $to_uid
 * @property string $vt_content
 * @property string $create_time
 * @property string $last_modify_time
 * @property string $from_status
 * @property string $to_status
 */
class PrivateMessageData extends CActiveRecord
{
    /**
     * Returns the static model of the specified AR class.
     * @return PrivateMessageDao the static model class
     */
    public static function model($className=__CLASS__)
    {
        return parent::model($className);
    }

    /**
     * @return string the associated database table name
     */
    public function tableName()
    {
        return '{{private_message}}';
    }

    /**
     * @return array validation rules for model attributes.
     */
    public function rules()
    {
        // NOTE: you should only define rules for those attributes that
        // will receive user inputs.
        return array(
            array('from_uid, to_uid, vt_content, create_time, last_modify_time', 'required'),
            array('from_uid, to_uid, vt_content, create_time, last_modify_time, from_status, to_status', 'length', 'max'=>10),
            // The following rule is used by search().
            // Please remove those attributes that should not be searched.
            array('pmid, from_uid, to_uid, vt_content, create_time, last_modify_time, from_status, to_status', 'safe', 'on'=>'search'),
        );
    }

    /**
     * @return array relational rules.
     */
    public function relations()
    {
        // NOTE: you may need to adjust the relation name and the related
        // class name for the relations automatically generated below.
        return array(
        );
    }

    /**
     * @return array customized attribute labels (name=>label)
     */
    public function attributeLabels()
    {
        return array(
            'pmid' => 'Pmid',
            'from_uid' => 'From Uid',
            'to_uid' => 'To Uid',
            'vt_content' => 'Vt Content',
            'create_time' => 'Create Time',
            'last_modify_time' => 'Last Modify Time',
            'from_status' => 'From Status',
            'to_status' => 'To Status',
        );
    }

    /**
     * Retrieves a list of models based on the current search/filter conditions.
     * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
     */
    public function search()
    {
        // Warning: Please modify the following code to remove attributes that
        // should not be searched.

        $criteria=new CDbCriteria;

        $criteria->compare('pmid',$this->pmid,true);
        $criteria->compare('from_uid',$this->from_uid,true);
        $criteria->compare('to_uid',$this->to_uid,true);
        $criteria->compare('vt_content',$this->vt_content,true);
        $criteria->compare('create_time',$this->create_time,true);
        $criteria->compare('last_modify_time',$this->last_modify_time,true);
        $criteria->compare('from_status',$this->from_status,true);
        $criteria->compare('to_status',$this->to_status,true);

        return new CActiveDataProvider(get_class($this), array(
            'criteria'=>$criteria,
        ));
    }
}
